<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-propertyConstraint-edit" th:object="${propertyConstraint}">
            <input name="beanName"  type="hidden"  th:field="*{beanName}" id="lookupId"/>
            <input id="configPropertyConstraintId" name="configPropertyConstraintId" th:field="*{configPropertyConstraintId}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input id="name" name="name" th:field="*{name}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">描述：</label>
                <div class="col-sm-8">
                    <input id="description" name="description" th:field="*{description}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">约束验证类Bean名称：</label>
                <div class="col-sm-8">
                    <!--<input id="beanName" name="beanName" th:field="*{beanName}" class="form-control" type="text">-->
                    <!--<input id="lookupName"   name="onlyValidateNoSave"  onclick="selectPropConstraintBeanList()"  th:value="*{propertyConstraint?.name}+'['+*{propertyConstraint?.description}+']'" class="form-control" type="text" readonly>-->
                    <input id="lookupName"   name="onlyValidateNoSave"  onclick="selectPropConstraintBeanList()"  th:if="${propertyConstraintBean} ==null"   class="form-control" type="text" readonly>
                    <input id="lookupName"   name="onlyValidateNoSave"  onclick="selectPropConstraintBeanList()"  th:if="${propertyConstraintBean} !=null"  th:value="${propertyConstraintBean?.name}+'['+${propertyConstraintBean?.description}+']'" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">约束验证使用的参数值：</label>
                <div class="col-sm-8">
                    <!--<input id="beanParameter" name="beanParameter" th:field="*{beanParameter}" class="form-control" type="text">-->
                    <textarea  id="beanParameter" name="beanParameter" th:field="*{beanParameter}" class="form-control"  rows="3" cols="20"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <!--<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">-->
                    <textarea  id="remark" name="remark" th:field="*{remark}" class="form-control"  rows="3" cols="20"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">创建者：</label>
                <div class="col-sm-8">
                    <input id="createBy" name="createBy" th:field="*{createBy}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">创建时间：</label>
                <div class="col-sm-8">
                    <input id="createTime" name="createTime" th:field="*{createTime}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">更新者：</label>
                <div class="col-sm-8">
                    <input id="updateBy" name="updateBy" th:field="*{updateBy}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">更新时间：</label>
                <div class="col-sm-8">
                    <input id="updateTime" name="updateTime" th:field="*{updateTime}" class="form-control" type="text" readonly>
                </div>
            </div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/propertyConstraint"
		$("#form-propertyConstraint-edit").validate({
			rules:{
                name:{
                    required:true,
                },
                description:{
                    required:true,
                },
                beanName:{
                    required:true,
                },
                onlyValidateNoSave:{
                    required:true,
                },
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/edit", $('#form-propertyConstraint-edit').serialize());
			}
		});

        /*选择属性约束列表*/
        function selectPropConstraintBeanList() {
            var lookupId = $("#lookupId").val();
            if(lookupId == ""||lookupId==undefined){
                lookupId="";
            }

            var url = ctx + "module/propertyConstraintBean/lookupList?lookupId="+lookupId;
            var options = {
                title: '约束验证类Bean名称',
                width: "780",
                height: "380",
                url: url,
                callBack: function(index, layero){
                    var body = layer.getChildFrame('body', index);
                    $("#lookupId").val(body.find('#lookupId').val());
                    $("#lookupName").val(body.find('#lookupName').val());
                    layer.close(index);
                }
            };
            $.modal.openOptions(options);
        }
	</script>
</body>
</html>
